<template>
    <div class="box" :style="{height : innerHeight}">
        <headerCom @router="router">
            <template v-slot:center>
                <span class="center">
                    设置
                </span>
            </template>
        </headerCom>

        <div class="row">
            <van-cell title="账号安全" is-link to="/accounts" />
        </div>

        <div class="row">
            <van-cell title="云打印机" is-link to="/CloudPrinters" />
            <van-cell title="自动接单" >
                <van-switch v-model="checked1" size="20px" active-color="#ff6357" inactive-color="#dcdee0" />
            </van-cell>
        </div>      
        <div class="text">
            开启自动接单后，有新订单时自动打印订单，并变更订单状态为配送中，节约订单处理时间。
        </div>     

        <div class="row">
        <van-cell title="新消息通知" >  
            <van-switch v-model="checked2" size="20px" active-color="#ff6357" inactive-color="#dcdee0" />
        </van-cell>
        <van-cell title="隐私管理" is-link to="/PrivacyManagement" />
        <van-cell title="选择语言" is-link to="/SelectLanguage" value="选择语言" />
        <van-cell title="关于我们" is-link to="/AboutUs" />
        </div>

        <div class="row">
            <van-cell class="change" title="切换店铺"  to="/SwitchStores" />
        </div>

        <div class="row">
            <van-cell class="exit" title="退出登录"  @click="exitLogin" />
        </div>
    


    </div>
</template>


<script>
import Vue from 'vue';
import { Dialog } from 'vant';
// 全局注册
Vue.use(Dialog);

import headerCom from '../../components/BS/header2View.vue'
export default {
    name : 'SettingView',
    components:{
        headerCom
    },
    data(){
        return{
            innerHeight:'',
            checked1: true,
            checked2: true,

        }
    },
    created(){
        this.innerHeight=window.innerHeight+'px'
    },
    methods:{
        exitLogin(){
            Dialog.confirm({
            message: '退出后店铺状态将变更为休息中，是否退出当前帐号？',
            cancelButtonText:'取消',
            confirmButtonText:'确认退出',
            })
            .then(() => {
            // on confirm  确认退出
                this.$router.push({ path:'/captchaLogin'})   //退出登录，页面跳转，删除token
            })
        },
        router(){
            this.$router.push('/tar/meView')
        }

    }
}
</script>

<style scoped>
    .box{
        background-color: #f5f5f5;
    }
    .row{
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .top{
        margin: auto;
    }
    .change{
        text-align: center; 
    }
 
  .exit{
        text-align: center; 
        color: #ff5b51;
    }
.text{
    width: 92%;
    margin: auto;
    font-size: 14px;
    color:#999999
}
    


</style>